<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="css/pagination.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet"
	type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>订单管理</title>
</head>
<body>
	<!-- <nav class="breadcrumb">
		<a class="btn btn-success btn-refresh radius r mr-20"
			style="line-height:1.6em;margin-top:3px" onclick="javascript:location.replace(location.href);" 
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="Hui-iconfont">&#xe68f;</i></a>
	</nav> -->
	<nav class="breadcrumb">
		<i class="Hui-iconfont">&#xe67f;</i> 首页
		 <span class="c-gray en">&gt;</span>订单列表
		
		<a class="btn btn-success btn-refresh radius r mr-20"
			style="line-height:1.6em;margin-top:3px" onclick="javascript:location.replace(location.href);" 
			href="javascript:location.replace(location.href);" title="刷新"><i
			class="Hui-iconfont">&#xe68f;</i></a>
	</nav>
	<div class="pd-20">
	
		<div class="cl pd-5 bg-1 bk-gray">
			<a id="one" name="-1" class="title rleft def">全部</a>
			<a id="two" name="0" class="title def">待处理</a>
			<a id="three" name="1" class="title def">正在处理</a>
			<a id="four" name="2" class="title def">配送中</a>
			<a id="fives" name="3" class="title def">已完成</a>
			<a id="six" name="4" class="title rright def">已取消</a>
		</div>
		<div class="mt-20"></div>
	
	<div class="cl pd-5 bg-1 bk-gray"> 
		<form action="<%=path%>/backstage/shop-order-list" method="get" class="form form-horizontal" id="search-form">
			<div class="text-c"> 
				<div class="row cl">
					<label class="form-label col-1">订单号：</label>
					<div class="formControls col-2">
					<input type="text" name="title" value="${conditions.title}" id="title" placeholder="订单号" class="input-text col-2">
					</div>
					
					<label class="form-label col-1">收货电话：</label>
					<div class="formControls col-2">
					<input type="text" name="mobile" value="${conditions.mobile}" id="title" placeholder="收货电话" class="input-text col-2">
					</div>
					
					<label class="form-label col-1">支付方式：</label>
					<div class="formControls col-2"> 
						<span class="select-box">
							<select class="select" id="zftype" name="zftype">
								<option value="-1">----</option>
								<option <c:if test="${conditions.zftype==0 }">selected</c:if> value="0">余额支付</option>
								<option <c:if test="${conditions.zftype==1 }">selected</c:if> value="1">支付宝支付</option>
								<option <c:if test="${conditions.zftype==2 }">selected</c:if> value="2">微信支付</option>
								<option <c:if test="${conditions.zftype==3 }">selected</c:if> value="3">货到付款</option>
							</select>
						</span>
		   			</div>
		   			
		   			<label class="form-label col-1">订单状态：</label>
					<div class="formControls col-2"> 
						<span class="select-box">
							<select class="select" id="status" name="status">
								<option value="-1">----</option>
								<option <c:if test="${conditions.status==0 }">selected</c:if> value="0">待处理</option>
 								<option <c:if test="${conditions.status==1 }">selected</c:if> value="1">正在处理</option>
 								<option <c:if test="${conditions.status==2 }">selected</c:if> value="2">配送中</option>
								<option <c:if test="${conditions.status==3 }">selected</c:if> value="3">已完成</option>
							    <option <c:if test="${conditions.status==4 }">selected</c:if> value="4">已取消</option>
							</select>
						</span>
		   			</div>
				</div>
				<div class="mt-10"></div>


				<div class="row cl">
					<label class="form-label col-1">配送员：</label>
					<div class="formControls col-2">
					<input type="text" name="cName" value="${conditions.cName}" id="cName" placeholder="配送员" class="input-text col-2">
					</div>
		   			
		   			<label class="form-label col-1">收货人：</label>
					<div class="formControls col-2">
						<input type="text" name="name" value="${conditions.name}" id="name" placeholder="收货人" class="input-text col-2">
					</div>
					
					<label class="form-label col-1">下单时间：</label>
					<div class="formControls col-2">
						<input type="text"  name="stime" readonly="readonly"  onfocus="WdatePicker({maxDate:'#F{$dp.$D(\'datemax\')}'})"  value="${conditions.stime}"  id="datemin" class="input-text Wdate" >
					</div>
					<div class="formControls col-2">
						<input type="text" name="etime" readonly="readonly" value="${conditions.etime}" onfocus="WdatePicker({minDate:'#F{$dp.$D(\'datemin\')}'})" id="datemax" class="input-text Wdate" >
					</div>
	   			</div>
	   			
	   			<div class="row cl">
		   			<label class="form-label col-1">站点：</label>
					<div class="formControls col-2">
					<span class="select-box">
						<select name="cityId" class="select" >
							<option value="-1">----</option>
							<c:forEach items="${citys}" var="city">
							<option value="${city.id}" <c:if test="${city.id==conditions.cityId}">selected</c:if> >${city.name}</option>
							</c:forEach>
						</select>
					</span>
					</div>
					
					<label class="form-label col-1">商店名称：</label>
					<div class="formControls col-2">
					<input type="text" name="c_sname" value="${conditions.c_sname}" id="c_sname" placeholder="商店名称" class="input-text col-2">
					</div>
				</div>
				
				<div class="row cl">
				<button name="" id="" class="btn btn-success f-r radius mr-20" type="submit"><i class="Hui-iconfont">&#xe665;</i> 查询</button>
				<div style="width:10px;height:5px;float:right;"></div>
					<button name="" onclick="theReset();" id="" class="btn btn-success" style="border-radius:5px;float:right;" >
						 重置
					</button>
				</div>
			</div>
		</form>
		</div>
		<div>
		</div>
		<div class="mt-20">
			<table style="width:2000px;"
				class="table table-border table-bordered table-hover table-bg table-sort">
				<thead>
					<tr class="text-c">
						<th>操作</th>

						<th>商家编号</th>
						<th>商店名称</th>
						<th>订单号</th>
						<th>订单状态</th>
						<th>支付方式</th>
						<th>金额</th>
						<th>商家电话</th>
						<th>收货人</th>
						<th>收货电话</th>
						<th>备注</th>
						<th>收货地址</th>
						<th>下单时间</th>
						<th>配送时间</th>
						<th>完成时间</th>
						<th>配送员</th>
						<th>配送评价</th>
						<th>商品评价</th>
						<th>取消订单</th>
					
					</tr>
				</thead>
				<tbody>
						<c:forEach items="${orders}" var="order">
						<tr class="text-c">
							<input type="hidden" id="orderid" name="orderid" value='${order.titles}' />

							<td class="td-manage"><%-- <a style="text-decoration:none"
								onClick="shop_edit(this,'${shop.cId}')" href="javascript:;"
								title="编辑">编辑 &nbsp;&nbsp; <a style="text-decoration:none"
									onClick="shop_enable(this,'${shop.cId}')" href="javascript:;"
									title="审核">审核</a>&nbsp;&nbsp; <a style="text-decoration:none"
									onClick="shop_del(this,'${shop.cId}')" href="javascript:;"
									title="查看">查看</a> --%>
								<a class="label label-primary radius" onclick="show('订单详情','<%=path%>/backstage/order-details?rid=${order.rid}');" href="javascript:;" title="详情">详情</a>	
							</td>

							<td>${order.shop_id }</td>
							<td>${order.c_sname }</td>
							<td>${order.titles }</td>
							<td>
								<c:choose>
									<c:when test="${order.enable == 2 || order.enable == 4}">
										已取消
									</c:when>
									<c:when test="${order.enable == 3}">
										已退货
									</c:when>
									<c:when test="${(order.enable == 1 && order.dd_status == 1 && order.zi_status ==1) or (order.enable == 1 && order.dd_status == 1 && order.zi_status ==0 && order.zf_type == 3) }">
										待处理
									</c:when>
									<c:when test="${order.enable == 5}">
										已完成
									</c:when>
									<c:when test="${order.spstatus < 4}">
										正在处理
									</c:when>
									<c:when test="${order.spstatus > 3}">
										配送中
									</c:when>
									<c:when test="${order.zi_status == 0 && order.zf_type != '3'}">
										未支付
									</c:when>
									<c:otherwise>
										未知
									</c:otherwise>
								</c:choose>
							
							</td>
							<td>
								<c:choose>
									<c:when test="${order.zi_status == 0 && order.zf_type != '3'}">
										未支付
									</c:when>
									<c:when test="${order.zf_type == '0'}">
										余额支付
									</c:when>
									<c:when test="${order.zf_type == '1'}">
										支付宝
									</c:when>
									<c:when test="${order.zf_type == '2'}">
										微信
									</c:when>
									<c:when test="${order.zf_type == '3'}">
										货到付款
									</c:when>
								</c:choose>
							</td>
							<td>${order.paymoney }</td>
							<td>${order.c_mobi }</td>
							<td>${order.name }</td>
							<td>${order.mobile }</td>
							<td>${order.bz }</td>
							<td>${order.address }</td>
							<td>${order.appdate }</td>
							<td>${order.senddate }</td>
							<td>${order.arrive_user_time }</td>
							<td>${order.c_tname }</td>
							<td>${order.shipping_remark }</td>
							<td>${order.dp }</td>
			                 <td>
			                	<c:if test="${order.enable != 2 && order.enable != 4 && order.enable != 3}">
									 <a class="label label-primary radius" onclick="check_return('${order.titles }')" href="javascript:void(0);" title="取消订单">取消订单</a>
								</c:if>
			                </td>
						</tr>
					</c:forEach>
				</tbody>
			</table>
		<div id="Pagination" class="page-con"></div>
		</div>
	</div>
	<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
	<script type="text/javascript" src="lib/layer/1.9.3/layer.js"></script>
	<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script>
	<script type="text/javascript"
		src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<script type="text/javascript" src="js/H-ui.js"></script>
	<script type="text/javascript" src="js/jquery.pagination.js"></script>
	<script type="text/javascript" src="js/H-ui.admin.js"></script>
	<script type="text/javascript">
	
	$(function() {
		initPager();
	});
	
	var showCount = ${pageInfo.showCount};
	var currentPage = ${pageInfo.currentPage-1};
	var totalResult = ${pageInfo.totalResult};
	function initPager(){
		$("#Pagination").pagination(totalResult, {
            callback: function(new_page_index, pagination_container){
            	var oldLocation = location.href;
            	var pa = "currentPage=" + (new_page_index+1);
        		var shoC = "showCount=" + showCount;
            	var index = oldLocation.lastIndexOf("?");
            	if (index == -1){
            		location.href = oldLocation + "?" + pa + "&" + shoC;
            	}else if (oldLocation.indexOf("currentPage") == -1){
            		location.href = oldLocation + "&" + pa;
            	}else if (oldLocation.indexOf("showCount") == -1){
            		location.href = oldLocation + "&" + shoC;
            	}else{
            		var temp = oldLocation.replace(/currentPage=\d+/, pa);
					var newLocation = temp.replace(/showCount=\d+/, shoC);
            		location.href = newLocation;
            	}
            	return false;
            },
            items_per_page:showCount, 
            load_first_page:false,
            prev_text:'上一页',
            next_text:'下一页',
            ellipse_text:'...',
            num_edge_entries:1,
            num_display_entries:5,
            current_page:currentPage,
        });
	}
	
	/*确认取消订单*/
	function check_return(orderId){
		var edit_page = "<%=path%>/backstage/request-cancle-order?orderId="+orderId;
		layer_show("确认取消订单",edit_page);
	}
	
	/*
	重置
	*/
	function theReset(){
		$("#search-form input[type='text']").val('');
		$("#search-form select").val(-1);
	}
	
	/*
	打印
	*/
	function printPage(){
		var bePrintedOrders = $("input[name='rids']:checked");
		if (bePrintedOrders.length <= 0){
			layer.tips('请勾选要打印的订单', '#printBtn');
			return ;
		}
		var data = "";
		for (var i = 0; i < bePrintedOrders.length; i++){
			if (i == 0){
				data += "?orderIds=" + bePrintedOrders[i].value; 
			}else{
				data += "&orderIds=" + bePrintedOrders[i].value; 
			}
		}
		var index =	layer.open({
			type:2,
			title:'',
			scrollbar: false,
			content:'<%=path%>/backstage/orders-print' + data,
			area:  ['500px', '500px'],
			success: function(layero, index){
				window.frames[0].$("#printBtn").click();
			    }
		});
	}
		
		/*查看*/
	function show(title,url){
		var index = layer.open({
			type: 2,
			title: title,
			content: url
		});
		layer.full(index);
	}
		
	function del(){
		layer.msg('未删除', {icon:5,time:1000});
	}	
	

	$(".title").click(function(){
		$(".title").css({"background":"white","border":"1px solid black","color":"black"});
		$(this).css({"background":"#5a98de","border":"1px solid #5a98de"});
		$("#status").val($(this).attr("name"));
		$("#search-form").submit();
	});
	
	if($("#status").val()==-1){
		$(".title").css({"background":"white","border":"1px solid black","color":"black"});
		$("#one").css({"background":"#5a98de","border":"1px solid #5a98de"});
	}else if($("#status").val()==0){
		$(".title").css({"background":"white","border":"1px solid black","color":"black"});
		$("#two").css({"background":"#5a98de","border":"1px solid #5a98de"});
	}else if($("#status").val()==1){
		$(".title").css({"background":"white","border":"1px solid black","color":"black"});
		$("#three").css({"background":"#5a98de","border":"1px solid #5a98de"});
	}else if($("#status").val()==2){
		$(".title").css({"background":"white","border":"1px solid black","color":"black"});
		$("#four").css({"background":"#5a98de","border":"1px solid #5a98de"});
	}else if($("#status").val()==3){
		$(".title").css({"background":"white","border":"1px solid black","color":"black"});
		$("#fives").css({"background":"#5a98de","border":"1px solid #5a98de"});
	}else if($("#status").val()==4){
		$(".title").css({"background":"white","border":"1px solid black","color":"black"});
		$("#six").css({"background":"#5a98de","border":"1px solid #5a98de"});
	}




</script>
</body>
</html>